if icon of btn "switch" is 282 then click at loc of btn "switch"
hide cd fld "instructions"
end closeCard
on calculate
get char 1 of card field "EMF"
if it="+" then
delete char 1 of card field "EMF"
end if
put card field "EMF" into E
get char 1 of card field "R1"
if it="+" then
delete char 1 of card field "R1"
end if
put card field "R1" into R1
put abs(R1) into card field "R1"
put abs(R1) into R1
if E=0 then
send zeroall
exit calculate
else
if R1=0 then
put "zap" into card field "A1"
put 0 into card field "V1"
exit calculate
end if
put E/R1 into I1
put E/1 into V1
end if
--set numberFormat to "0.000"
put I1 into card field "A1"
put V1 into card field "V1"
end calculate
--on closeField
--set icon of btn "switch" to "open circuit"
--send zeroall
--end closeField
on zeroall
put 0 into card field "A1"
put 0 into card field "V1"
end zeroall
-- part 1 (button)
-- low flags: 00
-- high flags: 0000
-- rect: left=320 top=164 right=198 bottom=359
-- title width / last selected line: 0
-- icon id / first selected line: 28757 / 28757
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: switch
----- HyperTalk script -----
on mouseUp
if icon of me is 28757 then
set icon of me to "close circuit"
calculate
else
set icon of me to "open circuit"
zeroall
end if
end mouseUp
-- part 2 (field)
-- low flags: 00
-- high flags: 0000
-- rect: left=178 top=140 right=153 bottom=241
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 65535
-- font id: 3
-- text size: 9
-- style flags: 256
-- line height: 12
-- part name: EMF
----- HyperTalk script -----
on closeField
if icon of cd btn "Switch" is not 28757 then calculate
end closeField
-- part 3 (field)
-- low flags: 00
-- high flags: 0000
-- rect: left=233 top=193 right=206 bottom=278
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 65535
-- font id: 3
-- text size: 9
-- style flags: 256
-- line height: 12
-- part name: R1
----- HyperTalk script -----
on closeField
if icon of cd btn "Switch" is not 28757 then calculate
end closeField
-- part 4 (field)
-- low flags: 01
-- high flags: 0002
-- rect: left=161 top=199 right=211 bottom=199
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 65535
-- font id: 3
-- text size: 8
-- style flags: 0
-- line height: 10
-- part name: A1
----- HyperTalk script -----
on mouseUp
if 3 = 4 then
end if
end mouseUp
-- part 5 (field)
-- low flags: 01
-- high flags: 0002
-- rect: left=239 top=254 right=266 bottom=275
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 65535
-- font id: 3
-- text size: 8
-- style flags: 0
-- line height: 10
-- part name: V1
----- HyperTalk script -----
on mouseUp
if 3 = 4 then
end if
end mouseUp
-- part 7 (button)
-- low flags: 00
-- high flags: 2000
-- rect: left=257 top=283 right=297 bottom=275
-- title width / last selected line: 0
-- icon id / first selected line: 16560 / 16560
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name:
----- HyperTalk script -----
on mouseUp
lock screen
go next
unlock screen with wipe left
end mouseUp
-- part 9 (button)
-- low flags: 00
-- high flags: A003
-- rect: left=203 top=108 right=125 bottom=293
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 3
-- text size: 10
-- style flags: 256
-- line height: 13
-- part name: Instructions
----- HyperTalk script -----
on mouseUp
set the visible of cd fld "instructions" to not the visible of cd fld "instructions"
end mouseUp
-- part 10 (field)
-- low flags: 81
-- high flags: 2002
-- rect: left=83 top=104 right=299 bottom=404
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 0
-- font id: 174
-- text size: 10
-- style flags: 0
-- line height: 12
-- part name: Instructions
----- HyperTalk script -----
on mouseUp
hide me
end mouseUp
-- part 11 (field)
-- low flags: 01
-- high flags: 0000
-- rect: left=242 top=82 right=103 bottom=369
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 65535
-- font id: 174
-- text size: 14
-- style flags: 2304
-- line height: 18
-- part name:
-- part 8 (field)
-- low flags: 81
-- high flags: 2002
-- rect: left=73 top=73 right=302 bottom=416
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 0
-- font id: 174
-- text size: 14
-- style flags: 16640
-- line height: 16
-- part name: Info
----- HyperTalk script -----
on mouseUp
hide me
end mouseUp
-- part contents for card part 4
----- text -----
0
-- part contents for card part 5
----- text -----
0
-- part contents for card part 3
----- text -----
20
-- part contents for card part 2
----- text -----
50
-- part contents for card part 8
----- text -----
This HyperCard sample allows students to enter different values for voltage and resistance, and then see how much current travels through various circuits.
After you have hidden this text, click
“Instructions” to learn how to use these lab exercises.
When you are finished, click this window’s close box.
CLICK HERE TO HIDE THIS TEXT AND SEE THE SAMPLE.
-- part contents for card part 10
----- text -----
Ohm’s Law states that current, i ,is proportional to the applied voltage, V:
i = V / R
where R is the resistance.
Enter values for the power source and for the resistors on this circuit, and then click the switch to see the results in the ammeter and the voltmeter.